//
//  Config.swift
//  jingxin
//
//  Created by Yuki on 2020/8/5.
//  Copyright © 2020 Zl. All rights reserved.
//

import UIKit

/// 比例宽度
/// - Returns: 比例
func width() ->CGFloat{
    return ScreenW() / 375.0;
}

/// 比例高度
/// - Returns: 比例
func height() -> CGFloat{
    if ScreenH() == 896{
        return ScreenH()/812.0;
    }else{
        if ScreenH() == 812 {
            return ScreenH()/812.0
        }
        return ScreenH()/667.0;
    }
}


//class Config: NSObject {
/// 屏幕宽度
/// - Returns: 屏幕宽度
func ScreenW() ->CGFloat{
    return UIScreen.main.bounds.size.width;
}

/// 屏幕高度
/// - Returns: 屏幕高度
func ScreenH() ->CGFloat{
    return UIScreen.main.bounds.size.height;
}

/// 安全区域的高度
/// - Returns: CGFloat
func SafeHeight() ->CGFloat{
    if UIApplication.shared.statusBarFrame.size.height > 20.0 {
        return 34.0;
    }else{
        return 0.0;
    }
}

/// tabBar的高度
/// - Returns: CGFloat;
func TabBarHeight() ->CGFloat{
    return SafeHeight() + 44.0;
}

/// 颜色色值
/// - Parameters:
///   - hex: 16进制颜色 0x000000
///   - alpha: 透明度
/// - Returns: UIColor
func Color(_ hex:NSInteger ,_ alpha:CGFloat) ->UIColor{
    return UIColor.init(red: CGFloat(((hex & 0xFF0000) >> 16))/255.0, green: CGFloat(((hex & 0xFF00) >> 8))/255.0, blue: CGFloat(((hex & 0xFF)))/255.0, alpha: alpha);
}



/// 判断字符串是否为空
/// - Parameter str: 待检测的字符串
/// - Returns: BOOL值，true为空，false为非空
func IsEmptyStr(checkStr str:AnyObject?)->Bool{
    if str == nil {
        return true;
    }else {
        if let myStr = str as? String {
            return myStr == "" || myStr == "null" || myStr == "(null)" || myStr == "<null>" || myStr == "NULL" || myStr.count == 0;
        }else{
            return false;
        }
    }
}



//}


